/*
 * @Date: 2020-08-24 09:38:11
 * @LastEditors: xujianxing
 * @LastEditTime: 2020-08-25 15:58:39
 * @FilePath: \nili\src\modules\user\user.service.ts
 */
import { Injectable, Inject } from '@nestjs/common';
import { IUser } from './interface/user';
import { UserDto } from './dto/create-user.dto';

@Injectable()
export class UserService {
  private readonly users: IUser[] = [];
  
  findAll(page, size): IUser[] {
    return this.users;
  }

  findById(id: number) {
    const user = this.users.find(u => {
      console.log(u, id);
      return u.id === id;
    });
    return user;
  }

  create(user: UserDto) {
    this.users.push(user);
    return 'add succ';
  }
}
